<?php
# global.php

$c="Verde que te quiero verde. \nVerde viento. Verdes ramas.";
echo "La cadena original es<br />[$c]<br />";
preg_match_all('/(.)(er)(..)/',$c,$gr);

print '$gr[0]=(';
foreach ($gr[0] as $v) echo "[$v] ";
print ')</br >';

print '$gr[1]=(';
foreach ($gr[1] as $v) echo "[$v]  ";
print ')</br >';

print '$gr[2]=(';
foreach ($gr[2] as $v) echo "[$v]  ";
print ')</br >';

echo'---------------------------------------------<br />';
$c="Verde que te quiero verde. \nVerde viento. Verdes ramas.\nVerde";

echo "La cadena original es<br />[$c]<br />";
preg_match("/verde/i",$c,$gr);

print "$gr[0]</br >";
print "$gr[1]</br >";
print "$gr[2]</br >";

if (preg_match('/(Verde.*Verde)/sx',$c,$gr))
    echo "sx encaja con<br />[$gr[0]]";
?>